package view.util;

import java.awt.Component;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;

public class ViewUtil {
	public static Component createLabelWithAlignment(final String title, final float alignment) {
		JLabel label = new JLabel(title);
		if (alignment == JLabel.LEFT_ALIGNMENT) {
			Box box = new Box(BoxLayout.LINE_AXIS);
			box.add(label);
			box.add(Box.createHorizontalGlue());
			return box;
		}
		label.setAlignmentX(alignment);
		return label;
	}
}
